//
// Created by YuWei on 2023/10/24.
//

#pragma once
#include<memory>
#include<vector>
#include "sql/operator/logical_operator.h"
#include "sql/parser/value.h"
class FieldMeta;

class UpdateLogicalOperator : public LogicalOperator
{
public:
  UpdateLogicalOperator()=default;
  virtual ~UpdateLogicalOperator() = default;

  LogicalOperatorType type() const override
  {
    return LogicalOperatorType::UPDATE;
  }
  void set_table(Table* table){
    table_=table;
  }
  Table *table() const
  {
    return table_;
  }
  void set_fields(const std::vector<const FieldMeta*> fields){
    fields_=fields;
  }
  const std::vector<const FieldMeta*>& fields(){
    return fields_;
  }
  void set_values(const std::vector<Value> values){
    values_=values;
  }
  const std::vector<Value>& values(){
    return values_;
  }
  void set_sub_opers(std::vector<std::unique_ptr<LogicalOperator> > sub_opers){
    sub_opers_=std::move(sub_opers);
  }
  std::vector<std::unique_ptr<LogicalOperator> >& sub_opers(){
    return sub_opers_;
  }
private:
  Table *table_ = nullptr;
  std::vector<const FieldMeta*> fields_;
  std::vector<Value> values_;
  std::vector<std::unique_ptr<LogicalOperator>> sub_opers_;
};